package com.yzy.yzy_crm.utils;

import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.stereotype.Repository;

@Repository
public class Md5Utils {
    public static String encryptPassword(String password,String salt){
        return new SimpleHash("md5",password,salt,24).toHex().toString();
    }

    public static String randomSalt(){
        SecureRandomNumberGenerator secureRandomNumberGenerator=new SecureRandomNumberGenerator();
        String hex=secureRandomNumberGenerator.nextBytes(3).toHex();
        return hex;
    }
}
